/**
 * 
 */
package org.vsg.stock.basic.domain;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Proxy;

/**
 * @author vison
 *
 */
@Entity
@Table(name = "STOCK_INFO")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
    name="kind",
    discriminatorType=DiscriminatorType.STRING
)
@Proxy(lazy = true)
public class StockInfo implements Serializable {
	
	@Id @Column(name="STOCK_CODE")
	private String code;
	
	@Column(name="STOCK_NAME")
	private String name;
	
    @ManyToMany(
            targetEntity=org.vsg.stock.basic.domain.StockCategory.class,
            cascade={CascadeType.ALL},
            fetch = javax.persistence.FetchType.EAGER
    )
     @JoinTable(
            name="STOCK_CATEGORY_MAP",
            joinColumns=@JoinColumn(name="STOCK_CODE"),
            inverseJoinColumns=@JoinColumn(name="ID_CATEGORY")
    )

	

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	

}
